package com.xxkfz.shedlock;

import net.javacrumbs.shedlock.core.LockProvider;
import net.javacrumbs.shedlock.provider.redis.spring.RedisLockProvider;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.core.RedisTemplate;

/**
 * TODO
 *
 * @author lujing
 * @since 2025/5/9 17:03
 **/
@Configuration
public class LockConfig {
    @Bean
    public LockProvider lockProvider(RedisTemplate<String, String> redisTemplate) {
        return new RedisLockProvider(redisTemplate.getConnectionFactory());
    }

//    @Bean
//    public LockProvider lockProvider(DataSource dataSource) {
//        return new JdbcTemplateLockProvider(dataSource);
//    }
}
